package com.zhike.common.exception;

import com.zhike.common.enums.ResultCode;

/**
 * Zkim异常类
 */

public class ZkimException extends RuntimeException {
    private static final long serialVersionUID = 6397082987802748517L;

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误信息
     */
    private String message;

    public ZkimException() {
        super();
    }

    public ZkimException(String message) {
        super(message);
        this.message = message;
    }

    public ZkimException(ResultCode result) {
        super(result.code() + "-" + result.message());
        this.code = result.code();
        this.message = result.message();
    }

    public ZkimException(ResultCode result, Throwable throwable) {
        super(result.code() + "-" + result.message() + ", " + throwable.getMessage(), throwable);
        this.code = result.code();
        this.message = result.message();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
